// 自定义守卫
class Car { money: number = 1000; carName: string = '保时捷' }
class Bus { money: number = 5000; busName: string = '大巴车' }
class Transportation {
  showInfo(vechile: Car | Bus) {
    if (isBus(vechile)) {
      vechile.busName  // vechile is Bus确定了类型为 Bus
    } else {
      vechile.carName  // isBus接受2种类型，当实例不是Bus类型时，就是Car类型
    }
  }
}
function isBus(vechile: Bus | Car): vechile is Bus {
  return vechile instanceof Bus
}

// Vue3中的自定义类型守卫
declare const RefSymbol: unique symbol
export interface Ref<T = any> { value: T; [RefSymbol]: true; _shallow?: boolean }
export function isRef(r: any): r is Ref {
  return Boolean(r && r.__v_isRef === true)
}
export {}
